﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using SharpPcap;

namespace DnsCatcher.Service
{
    public partial class ReportingService : ServiceBase
    {
        public ReportingService(int ifIndex)
        {
            InitializeComponent();
            interfaceIndex = ifIndex;
        }

        private PacketCatcher catcher;
        private int interfaceIndex;

        protected override void OnStart(string[] args)
        {
            catcher = new PacketCatcher();
            catcher.BeginWatching(CaptureDeviceList.Instance[interfaceIndex]);
        }

        protected override void OnStop()
        {
            catcher.EndWatching();
        }
    }
}
